#include<stdio.h>
long long gcd(long long a,long long b)
{
    return !b?a:gcd(b,a%b);
}
int main()
{
    long long a,b,temp;
    scanf("%lld%lld",&a,&b);getchar();
    temp=gcd(a,b);
    printf("%lld\n",temp+(a*b)/temp);
    return 0;
}
